
%{--
  - Copyright 2010 Nicolas Martignole.
  - Licensed under the Apache License, Version 2.0 (the "License");
  - you may not use this file except in compliance with the License.
  - You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
  - required by applicable law or agreed to in writing, software distributed under
  - the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
  - OR CONDITIONS OF ANY KIND, either express or implied.
  - See the License for the specific language governing permissions
  - and limitations under the License.
  --}%

<%@ page import="org.letouilleur.celerio.Document" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'document.label', default: 'Document')}" />
        <title><g:message code="default.create.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}">Home</a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1><g:message code="default.create.label" args="[entityName]" /></h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${documentInstance}">
            <div class="errors">
                <g:renderErrors bean="${documentInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form action="save" method="post"  enctype="multipart/form-data">
                <div class="dialog">
                    <table>
                        <tbody>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="documentContentType"><g:message code="document.documentContentType.label" default="Document Content Type" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: documentInstance, field: 'documentContentType', 'errors')}">
                                    <g:textArea name="documentContentType" cols="40" rows="5" value="${documentInstance?.documentContentType}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="documentSize"><g:message code="document.documentSize.label" default="Document Size" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: documentInstance, field: 'documentSize', 'errors')}">
                                    <g:textField name="documentSize" value="${fieldValue(bean: documentInstance, field: 'documentSize')}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="documentFileName"><g:message code="document.documentFileName.label" default="Document File Name" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: documentInstance, field: 'documentFileName', 'errors')}">
                                    <g:textArea name="documentFileName" cols="40" rows="5" value="${documentInstance?.documentFileName}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="documentBinary"><g:message code="document.documentBinary.label" default="Document Binary" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: documentInstance, field: 'documentBinary', 'errors')}">
                                    <input type="file" id="documentBinary" name="documentBinary" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="account"><g:message code="document.account.label" default="Account" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: documentInstance, field: 'account', 'errors')}">
                                    <g:select name="account.id" from="${org.letouilleur.celerio.Account.list()}" optionKey="id" value="${documentInstance?.account?.id}" noSelection="['null': '']" />
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /></span>
                </div>
            </g:form>
        </div>
    </body>
</html>
